home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Updates / PowerPC / pdflib / bind / perl / hello.pl next >
Perl Script  |  2000-05-16  |  701b  |  32 lines

  1. #!/usr/bin/perl
  2. # hello.pl
  3. # Copyright (C) 1997-99 Thomas Merz. All rights reserved.
  4. #
  5. # PDFlib client: hello example in Perl
  6. #
  7.  
  8. use pdflib 2.01;
  9. package pdflib;
  10.  
  11. $p = PDF_new();
  12.  
  13. die "Couldn't open PDF file" if (PDF_open_file($p, "hello_pl.pdf") == -1);
  14.  
  15. PDF_set_info($p, "Creator", "hello.pl");
  16. PDF_set_info($p, "Author", "Thomas Merz");
  17. PDF_set_info($p, "Title", "Hello world (Perl)");
  18.  
  19. PDF_begin_page($p, 595, 842);
  20. $font = PDF_findfont($p, "Helvetica-Bold", "default", 0);
  21. die "Couldn't set font" if ($font == -1);
  22.  
  23. PDF_setfont($p, $font, 18.0);
  24.  
  25. PDF_set_text_pos($p, 50, 700);
  26. PDF_show($p, "Hello world!");
  27. PDF_continue_text($p, "(says Perl)");
  28. PDF_end_page($p);
  29. PDF_close($p);
  30.  
  31. PDF_delete($p);
  32.